package com.example.xadmin.util;

import sun.misc.BASE64Encoder;

import java.security.MessageDigest;

public class Md5Util {

    private Md5Util() {
    }

    public static String encode(String str) throws Exception {
        MessageDigest messageDigest = MessageDigest.getInstance("MD5");
        BASE64Encoder base64Encoder = new BASE64Encoder();
        return base64Encoder.encode(messageDigest.digest(str.getBytes("utf-8")));
    }


}
